home *** CD-ROM | disk | FTP | other *** search
-
- 24. Bit Operators
-
- C has several operators for logical bit-operations. For example,
-
- x = x & 0177;
-
- forms the bit-wise AND of x and 0177, effectively retaining only the last seven bits of x. Other operators are
-
- | inclusive OR
- ^ (circumflex) exclusive OR
- ~ (tilde) 1’s complement
- ! logical NOT
- << left shift (as in x<<2)
- >> right shift (arithmetic on PDP-11; logical on H6070, IBM360)
-